home *** CD-ROM | disk | FTP | other *** search
/ Adventures with Oslo: Tools & Gadgets / Adventures with Oslo - Tools and Gadgets.ISO / mac / Ad / Mod04 / mstrmind.Dir / 00061.ls < prev    next >
Encoding:
Text File  |  1994-09-23  |  2.8 KB  |  104 lines

  1. on startMovie
  2.   global gTools, guesses, gBackPack
  3.   set HC to the number of cast "handCursor"
  4.   cursor([HC, HC + 1])
  5.   if getOne(gBackPack, #vmap) = 0 then
  6.     set the visible of sprite 45 to 0
  7.   end if
  8.   if voidp(gTools) then
  9.     set gTools to []
  10.   end if
  11.   set guesses to [[], [], [], []]
  12.   put "(none" into word 1 of field "guess one"
  13.   put "(none" into word 1 of field "guess two"
  14.   put "(none" into word 1 of field "guess three"
  15.   put "0" into field "guess four"
  16. end
  17.  
  18. on getATool
  19.   go(the name of cast the castNum of sprite the clickOn)
  20. end
  21.  
  22. on oldGetATool
  23.   global gTools
  24.   if count(gTools) = 4 then
  25.     alert("Sorry, you can't carry that many tools.")
  26.   else
  27.     append(gTools, the name of cast the castNum of sprite the clickOn)
  28.     set the locH of sprite the clickOn to -200
  29.     updateStage()
  30.   end if
  31. end
  32.  
  33. on showTools
  34.   global gTools, guesses
  35.   deleteAt(guesses, 1)
  36.   append(guesses, gTools)
  37.   put field "guess two" into field "guess one"
  38.   put field "guess three" into field "guess two"
  39.   if field "guess four" = 0 then
  40.     put "(none" into word 1 of field "guess three"
  41.   else
  42.     put "(" & field "guess four" into word 1 of field "guess three"
  43.   end if
  44.   set spriteNum to 3
  45.   repeat with guessNum = 1 to 3
  46.     set guess to getAt(guesses, guessNum)
  47.     repeat with itemNum = 1 to count(guess)
  48.       set toolName to getAt(guess, itemNum)
  49.       put "light " before toolName
  50.       set the castNum of sprite spriteNum to the number of cast toolName
  51.       set spriteNum to spriteNum + 1
  52.     end repeat
  53.     repeat with i = 1 to 4 - count(guess)
  54.       set the castNum of sprite spriteNum to the number of cast "blank"
  55.       set spriteNum to spriteNum + 1
  56.     end repeat
  57.   end repeat
  58.   updateStage()
  59.   repeat with itemNum = 1 to count(gTools)
  60.     set toolName to getAt(gTools, itemNum)
  61.     put "small " before toolName
  62.     set the castNum of sprite spriteNum to the number of cast toolName
  63.     set spriteNum to spriteNum + 1
  64.     puppetSound(the name of cast (the number of cast "marimba1" + itemNum - 1))
  65.     updateStage()
  66.     wait(30)
  67.   end repeat
  68.   repeat with i = 1 to 4 - count(gTools)
  69.     set the castNum of sprite spriteNum to the number of cast "blank"
  70.     set spriteNum to spriteNum + 1
  71.   end repeat
  72.   puppetSound(0)
  73.   set temp to check(gTools)
  74.   if temp = 4 then
  75.     go("win")
  76.   else
  77.     wait(30)
  78.     put temp into field "guess four"
  79.   end if
  80. end
  81.  
  82. on wait ticks
  83.   set temp to the timer
  84.   repeat while (the timer - temp) < ticks
  85.   end repeat
  86. end
  87.  
  88. on check thisList
  89.   set total to 0
  90.   if getOne(thisList, "pick") <> 0 then
  91.     set total to total + 1
  92.   end if
  93.   if getOne(thisList, "pointy shovel") <> 0 then
  94.     set total to total + 1
  95.   end if
  96.   if getOne(thisList, "drill") <> 0 then
  97.     set total to total + 1
  98.   end if
  99.   if getOne(thisList, "ladder") <> 0 then
  100.     set total to total + 1
  101.   end if
  102.   return total
  103. end
  104.